<?php
/* @var $this VideoController */
/* @var $model Video */
/* @var $form CActiveForm */
 
?> 
<script type="text/javascript">
    $(document).ready(function(e) {
       $("#relevance").colorbox({
        href:"<?php echo Yii::app()->createUrl('/video/viewfile')?>",
        close: "【关闭】",
        initialWidth:600,
        initialHeight:500,
        width:'600px',
        height:'500px',
        title:"关联文件" 
       });
      
    }); 
     function callbacks(path,size){
        $('#url').val(path);
        $('#filesize').val(size); 
       }
</script>


<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'video-form',
    'enableAjaxValidation'=>false,
    'htmlOptions' => array('enctype'=>'multipart/form-data'),
)); ?>

	<p class="note"><span class="required">*</span> 是必填内容.</p>


	<div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>128)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>

	
	<div class="row">
		<?php echo $form->labelEx($model,'content'); ?>
		<?php echo $form->textArea($model,'content',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'content'); ?>
	</div>

    <div class="row">
        <?php echo $form->labelEx($model,'cover'); ?>
        <?php echo CHtml::activeFileField($model,'cover');?>
        <?php echo $form->error($model,'cover'); ?>
    </div>

    <div class='row'>
        <?php
        if($model->cover !==''){
            echo CHtml::label("封面预览",false);
            echo CHtml::image(Yii::app()->baseUrl.$model->cover,'',array("width"=>"450px"));
        }
        ?>
       
        <?php echo  CHtml::button('关联文件',array('id'=>'relevance')); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'url'); ?>
        <?php echo $form->textField($model,'url',array('size'=>60,'maxlength'=>128,'id'=>'url'));?>
        <?php echo $form->error($model,'url'); ?>
    </div>


	<div class="row">
		<?php echo $form->labelEx($model,'filesize'); ?>
		<?php echo $form->textField($model,'filesize',array('size'=>60,'maxlength'=>128,'id'=>'filesize')); ?>
		<?php echo $form->error($model,'filesize'); ?>
	</div>  


	<div class="row">
		<?php echo $form->labelEx($model,'categoryid'); ?>
		<?php echo $form->dropDownList(
            $model,
            'categoryid',
            CHtml::listData(
                 $category,
                'id',
                'name'
            )
        ); ?>
		<?php echo $form->error($model,'categoryid'); ?>
	</div> 

	<div class="row buttons">
        <?php echo CHtml::submitButton($model->isNewRecord ? '新增' : '修改',array('class'=>'subButton')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->